package com.leaf.lowcode.generator;
import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectMySql {

    public static Connection connect() {
        String driverName = null;
        String url = null;
        String userName = null;
        String password = null;
        Connection connection = null;

        driverName = "com.mysql.cj.jdbc.Driver";
        url = "jdbc:mysql://10.140.161.87:3306/door?serverTimezone=UTC";
        userName = "root";
        password = "123456";
        try {
            Class.forName(driverName);
            connection = DriverManager.getConnection(url, userName, password);
            System.out.println("数据库连接成功！");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return connection;
    }
}
